package com.example.bishe.util;

/**
 * 功能描述
 *
 * @author: LDH
 * @date: 2023年05月12日 15:47
 */
public class xorEncrypt {

    public static char setKey(String openId){
        char key = openId.charAt(0);
        for (int i = 1; i < openId.length(); i++) {
            key ^= openId.charAt(i);
        }
        return key;
    }

    public static String xor(String text,char key){

        StringBuilder stringBuilder = new StringBuilder();
        for (int i = 0; i < text.length(); i++) {
            stringBuilder.append((char) (key^text.charAt(i)));
        }
        return stringBuilder.toString();
    }

}